﻿using System.Windows.Controls;
using System.Windows.Media;

namespace nRoute.Samples.FutureDesktop.Behaviors
{
    public class TextBlockHoverBehavior
        : HoverBehaviorBase<TextBlock>
    {

        private Brush _foreground;
        
#region Properties

        public Brush HoverForeground
        {
            get { return (Brush)GetValue(HoverForegroundProperty); }
            set { SetValue(HoverForegroundProperty, value); }
        }

#endregion

#region Overrides

        protected override void OnHighlight()
        {
            if (this.HoverForeground != null)
            {
                _foreground = this.AssociatedObject.Foreground;
                this.AssociatedObject.Foreground = this.HoverForeground;
            }
        }

        protected override void OnUnHighlight()
        {
            if (this.HoverForeground != null)
            {
                this.AssociatedObject.Foreground = _foreground;
                _foreground = null;
            }
        }

#endregion

    }
}
